package glassline.mock;

import glassline.Glass;
import glassline.interfaces.Conveyor;
import glassline.interfaces.Popup;
import glassline.interfaces.Sensor;

public class MockConveyor implements Conveyor {

	public int conveyorNumber;
	boolean hasBeginningPopup;
	public EventLog log = new EventLog();
	
	public MockConveyor(int whichConveyor, boolean hasBeginningPopup) {
		conveyorNumber = whichConveyor;
		this.hasBeginningPopup = hasBeginningPopup;
	}
	
	@Override
	public boolean hasBeginningPopup() {
		return hasBeginningPopup;
	}

	@Override
	public void msgHereIsGlass(Glass g) {
		log.add(new LoggedEvent(
					"Received msgHereIsGlass from previous conveyor, containing " + g));
	}

	@Override
	public void msgSensedGlass(Sensor sensor) {
		log.add(new LoggedEvent(
				"Received msgSensedGlass from sensor "+ sensor));

	}

	@Override
	public void msgIAmUp(boolean workstationsFull, Popup popup) {
		//log.add(new LoggedEvent(
		//		"Received msgIAmUp from " + popup + " and wokstationsFull is " + workstationsFull));
		log.add(new LoggedEvent("msgIAmUp"));
	}

	@Override
	public void msgIAmDown(Popup popup) {
		// TODO Auto-generated method stub

	}

	@Override
	public void msgIAmUp(Popup popup) {
		//log.add(new LoggedEvent(
		//		"Received msgIAmUp from " + popup));
		log.add(new LoggedEvent("msgIAmUp"));
	}

	@Override
	public void msgHereIsGlass(Glass g, Popup popup) {
		log.add(new LoggedEvent(
				"Recieved msgHereIsGlass with glass " + g + " from PopupAgent " + popup));
	}
	
	public String toString() {
		return "Conveyor " + conveyorNumber;
	}

}
